package com.wanli.agent.homepage;



import android.content.Intent;
import android.os.Bundle;

import com.bumptech.glide.Glide;
import com.wanli.agent.R;
import com.wanli.agent.base.BaseActivity;
import com.wanli.agent.utils.PinchImageView;

import butterknife.BindView;
import butterknife.ButterKnife;

public class PreviewPicturesActivity extends BaseActivity {

    private String type;

    @BindView(R.id.iv_preview_pictures)
    PinchImageView iv_preview_pictures;
    private String img;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_preview_pictures);
        ButterKnife.bind(this);
        initView();
        initData();
        initEvent();
    }

    private void initView() {
        Intent intent = getIntent();
        type = intent.getStringExtra("type");
        img = intent.getStringExtra("img");



    }


    private void initData() {


        if ("2".equals(type)){
            Glide.with(this).load(img).into(iv_preview_pictures);
        }else {
            // 加载应用资源
            int resource = R.mipmap.ic_no_data;

            switch (type) {
                case "1":
                    //门店门头照
                    resource = R.drawable.iv_shop_front_photo;
                    break;
                case "2":
                    //门店店内照片
                    resource = R.drawable.iv_store_photos;
                    break;
                case "3":
                    //门店收银台照
                    resource = R.drawable.iv_photo_store_cashier;
                    break;
                case "4":
                    //营业执照照片
                    resource = R.drawable.ivc_business_license;
                    break;
                case "5":
                    //银行卡号面
                    resource = R.drawable.iv_bank_card_number;
                    break;
                case "6":
                    //银行卡反面
                    resource = R.drawable.iv_reverse_side_bank_card;
                    break;
                case "7":
                    //开户许可证
                    resource = R.drawable.iv_account_opening_permit;
                    break;
                case "8":
                    //法人身份证正面
                    resource = R.drawable.iv_front_legal_person_id_card;
                    break;
                case "9":
                    //法人身份证反面
                    resource = R.drawable.iv_reverse_side_corporate_id_card;
                    break;
                case "10":
                    //手持身份证照
                    resource = R.drawable.iv_hand_held_id_card;
                    break;
                case "11":
                    //手持身份证照
                    resource = R.drawable.iv_change_application_form;
                    break;
                    case "12":
                    //手持身份证照
                    resource = R.mipmap.ic_shouquanshu;
                    break;
            }
            Glide.with(this).load(resource).into(iv_preview_pictures);

        }


    }

    private void initEvent() {
        iv_preview_pictures.setOnClickListener(view -> {
            finish();
        });

    }

}